﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace CampusMarket
{
    /// <summary>
    /// Window1.xaml 的交互逻辑
    /// </summary>
    public partial class Window1 : Window
    {
        private bool isSignup = false;
        public Window1()
        {
            InitializeComponent();
        }

        private void signup_Click(object sender, RoutedEventArgs e)
        {
            if (!isSignup)
            {
                isSignup = true;
                uiToRegister();
            }
            else
            {
                //throw new NotImplementedException();
            }
        }

        private void uiToRegister()
        {
            //shrink existing form
            usernameBox.Height = 25;
            passwordBox.Height = 25;
            //update page title
            this.Title = "Register";
            title.Content = "Sign Up";
            //adjust button
            login.Visibility = System.Windows.Visibility.Collapsed;
            signup.FontSize = 16; signup.Foreground = Brushes.Black;

            //add grid rows
            RowDefinition rd1 = new RowDefinition();
            rd1.Height = new GridLength(1, GridUnitType.Star);
            RowDefinition rd2 = new RowDefinition();
            formGrid.RowDefinitions.Add(rd1);
            rd2.Height = new GridLength(1, GridUnitType.Star);
            formGrid.RowDefinitions.Add(rd2);
            //show signup form
            repeatpwdBox.SetValue(Grid.RowProperty, 2);
            repeatpwdBox.Visibility = System.Windows.Visibility.Visible;
            repeatpwdImg.SetValue(Grid.RowProperty, 2);
            repeatpwdImg.Visibility = System.Windows.Visibility.Visible;
            phoneBox.SetValue(Grid.RowProperty, 3);
            phoneBox.Visibility = System.Windows.Visibility.Visible;
            phoneImg.SetValue(Grid.RowProperty, 3);
            phoneImg.Visibility = System.Windows.Visibility.Visible;
        }
    }
}
